package action.bbs.chapter;



import java.util.HashMap;
import java.util.Map;

import javax.servlet.http.HttpServletRequest;

import org.apache.catalina.Session;

import vo.ChapterVO;

import com.opensymphony.xwork2.ActionContext;
import static org.apache.struts2.StrutsStatics.HTTP_REQUEST;


import dao.Chapter_dao;
import intercepter.aware.Chapter_Awa;


public class ChapterNewest_A implements Chapter_Awa{

	private Chapter_dao dao;
	@Override
	public void setDao(Chapter_dao dao) {
		// TODO Auto-generated method stub
		this.dao = dao;
	}
	public String execute()throws Exception{
		Map<String, Object> session =   ActionContext.getContext().getSession();
		
		if(session.containsKey("chapterVO")){
			session.remove("chapterVO");
		}
		
		ChapterVO vo = dao.chpaterNewest();
		session.put("chapterVO",vo);
		ActionContext.getContext().setSession(session);
		System.out.println("chapter : "+((ChapterVO)ActionContext.getContext().getSession().get("chapterVO")).getChapter());
		return "success";
		
	}
	
	

	
	

	
	
}
